/**
 * 
 */
package com.gragra.dependencyParsing;
import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
import com.gragra.parseOptions.ListOfDoubleOption;
import com.gragra.parseOptions.Parser;
import com.gragra.sampling.PopulationProbabilityAssigner;
import com.gragra.sampling.nonproj.DistHeadConstraint;
/**
 * @author Christoph Teichmann
 * 25.09.2013
 */
public class DisHeadConstraint extends DisHeadModel
{
	/**
	 * 
	 */
	private double	functRootConstraint = 10.0;
	/**
	 * @return the functRootConstraint
	 */
	protected double getFunctRootConstraint()
	{return this.functRootConstraint;}
	/**
	 * @return the nounRootConstraint
	 */
	protected double getNounRootConstraint()
	{return this.nounRootConstraint;}
	/**
	 * 
	 */
	private final static String funcRootOpt = "fPen";
	/**
	 * 
	 */
	private double	nounRootConstraint = 10.0;
	/**
	 * 
	 */
	private double	verbConstraint = 10.0;
	/**
	 * 
	 */
	private final static String verbOpt = "vPen";
	/**
	 * 
	 */
	private double	determinerConstraint = 10.0;
	/**
	 * 
	 */
	private final static String determinerOpt = "dPen";
	/**
	 * 
	 */
	private double	adjectiveConstraint = 10.0;
	/**
	 * @return the verbConstraint
	 */
	protected double getVerbConstraint()
	{return this.verbConstraint;}
	/**
	 * @return the determinerConstraint
	 */
	protected double getDeterminerConstraint()
	{return this.determinerConstraint;}
	/**
	 * @return the adjectiveConstraint
	 */
	protected double getAdjectiveConstraint()
	{return this.adjectiveConstraint;}
	/**
	 * 
	 */
	private final static String adjectiveOpt = "aPen";
	/**
	 * 
	 */
	private final static String nounRootOpt = "nPen";
	/* (non-Javadoc)
	 * @see com.gragra.dependencyParsing.SimpleDMV#setParameters(com.gragra.parseOptions.Parser)
	 */
	@Override
	protected void setParameters(Parser pa)
	{
		this.functRootConstraint = (this.getValOrDefault(funcRootOpt, functRootConstraint, pa));
		this.nounRootConstraint = (this.getValOrDefault(nounRootOpt, nounRootConstraint, pa));
		this.adjectiveConstraint = this.getValOrDefault(adjectiveOpt, adjectiveConstraint, pa);
		this.determinerConstraint = this.getValOrDefault(determinerOpt, determinerConstraint, pa);
		this.verbConstraint = this.getValOrDefault(verbOpt, verbConstraint, pa);
		super.setParameters(pa);
	}

	/* (non-Javadoc)
	 * @see com.gragra.dependencyParsing.SimpleDMV#addParameters(com.gragra.parseOptions.Parser)
	 */
	@Override
	public void addParameters(Parser pa)
	{
		pa.addOption(funcRootOpt, new ListOfDoubleOption("set this option to an exponent for the constraint used to penalize function words as roots, the inverse will be used, default is 10.0"));
		pa.addOption(nounRootOpt, new ListOfDoubleOption("set this option to an exponent for the constraint used to penalize nouns as sentence roots, the inverse will be used, default value is 10.0"));
		pa.addOption(adjectiveOpt, new ListOfDoubleOption("set this option to an exponent for the constraint used to penalize adjectives that do ot attach to nouns or verbs, the inverse is used, default value is 10.0"));
		pa.addOption(determinerOpt, new ListOfDoubleOption("set this option to an exponent for the constraint used to penalize determiners without a noun edge, inverse is used, default value is 10.0"));
		pa.addOption(verbOpt, new ListOfDoubleOption("set this option to an exponent for the constraint used to penalize verbs without arguments, inverse is used, default value is 10.0"));
		super.addParameters(pa);
	}
	/* (non-Javadoc)
	 * @see com.gragra.dependencyParsing.SimpleDMV#makeModel(it.unimi.dsi.fastutil.ints.IntOpenHashSet)
	 */
	@Override
	protected PopulationProbabilityAssigner makeModel(IntOpenHashSet is)
	{return new DistHeadConstraint(getThreads(), is, getHeadAlpha(), getStopAlpha(), getFertAlpha(), nounRootConstraint, functRootConstraint, adjectiveConstraint, determinerConstraint, verbConstraint);}
}